<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            width: 100px;
            height: 100px;
            border: 1px solid #000;
        }
    </style>
</head>

<body>

    <div id="box">

    </div>

</body>
<script>


    function People(name, age) {
        this.username = name;
        this.age = age;
    }

    const p1 = new People('mark', 18);
    const p2 = new People('tom', 20);
    console.log(p1, p2)

    /* 注意事项1：箭头函数不可以作为构造函数使用 */
    const Person = (name, age) => {
        this.username = name;
        this.age = age;
    }

    /* 
    Uncaught TypeError: Person is not a constructor
    */
    const p3 = new Person('mark', 18);
    console.log('箭头函数的实例对象 p3', p3);







</script>

</html>